package malus.shaofeng.com.beiwomusic.model;

import com.lidroid.xutils.db.annotation.Column;
import com.lidroid.xutils.db.annotation.Foreign;
import com.lidroid.xutils.db.annotation.Id;
import com.lidroid.xutils.db.annotation.NoAutoIncrement;
import com.lidroid.xutils.db.annotation.Table;

import org.json.JSONObject;

import java.io.Serializable;

/**
 * Created by aaa on 15-3-10.
 */
@Table(name="newStory")
public class NewStory implements Serializable{
            @Id(column = "story_id")
            @NoAutoIncrement
            private long story_id;//: 13895,
            @Column(column = "title")
            private String title;//": "如何遇到你在我更从容的年纪,
            @Column(column = "view_title")
            private String view_title;//": "如何遇到你|在我更从容的年纪,
            @Column(column = "image_uri")
            private String image_uri;//": "/mnt/res.nmting.com/res/qms/20150310/jpg/95/d6/95d68a03ec984a18956079c9a7bba2d8.jpg,
            @Column(column = "content_summary")
            private String content_summary;//": "想起2013年冬天在北京去看了李宗盛的那场演唱会。回顾自己作品的时候，大屏幕上出现了那些风姿妖娆的女人们的头像，莫文蔚，陈淑桦，辛晓琪，梁静茹，免不了的也有林忆莲。\n现场有人大喊:林忆莲林忆莲林忆莲！,
            @Column(column = "content_url")
            private String content_url;//,": "http://kxai.cn/qms/ws/story/content.json?storyId=13895
            @Column(column = "comments")
            private int comments;//: 0,
            @Column(column = "like_count")
            private int like_count;//: 1,
            @Column(column = "reads")
            private int reads;//: 25,
            @Column(column = "tops")
            private int tops;//: 0,
            @Column(column = "forwards")
            private int forwards;//: 135,
            @Column(column = "release_time")
            private String release_time;//": "2015-03-10 10:00:55,

            @Foreign(column = "userId",foreign = "user_id")
            private User user;
            @Foreign(column = "musicId",foreign = "music_id")
            private NewStoryMusic music;


    public void parseJSON(JSONObject json){
        if (json!=null){
            story_id=json.optLong("story_id");
            title=json.optString("title");
            view_title=json.optString("view_title");
            image_uri=json.optString("image_uri");
            content_summary=json.optString("content_summary");
            content_url=json.optString("content_url");
            comments=json.optInt("comments");
            like_count=json.optInt("like_count");
            reads=json.optInt("reads");
            tops=json.optInt("tops");
            forwards=json.optInt("forwards");
            release_time=json.optString("release_time");

            JSONObject userObject = json.optJSONObject("user");
            user=new User();
            user.parseJSON(userObject);

            JSONObject musicObject = json.optJSONObject("music");
            music=new NewStoryMusic();
            music.parseJSON(musicObject);

        }
    }

    public long getStory_id() {
        return story_id;
    }

    public void setStory_id(long story_id) {
        this.story_id = story_id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getView_title() {
        return view_title;
    }

    public void setView_title(String view_title) {
        this.view_title = view_title;
    }

    public String getImage_uri() {
        return image_uri;
    }

    public void setImage_uri(String image_uri) {
        this.image_uri = image_uri;
    }

    public String getContent_summary() {
        return content_summary;
    }

    public void setContent_summary(String content_summary) {
        this.content_summary = content_summary;
    }

    public String getContent_url() {
        return content_url;
    }

    public void setContent_url(String content_url) {
        this.content_url = content_url;
    }

    public int getComments() {
        return comments;
    }

    public void setComments(int comments) {
        this.comments = comments;
    }

    public int getLike_count() {
        return like_count;
    }

    public void setLike_count(int like_count) {
        this.like_count = like_count;
    }

    public int getReads() {
        return reads;
    }

    public void setReads(int reads) {
        this.reads = reads;
    }

    public int getTops() {
        return tops;
    }

    public void setTops(int tops) {
        this.tops = tops;
    }

    public int getForwards() {
        return forwards;
    }

    public void setForwards(int forwards) {
        this.forwards = forwards;
    }

    public String getRelease_time() {
        return release_time;
    }

    public void setRelease_time(String release_time) {
        this.release_time = release_time;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public NewStoryMusic getMusic() {
        return music;
    }

    public void setMusic(NewStoryMusic music) {
        this.music = music;
    }
}
